package service

import (
	"github.com/LayGit/antsdk/api/trade"
	"fmt"
	"github.com/LayGit/antsdk/alipay"
)

type AliPay struct {
}

func( * AliPay) PreOrder(){
	client := alipay.NewDefaultAlipayClient("https://openapi.alipay.com/gateway.do", "商户AppId", "商户密钥", "支付宝公钥")
	// 创建请求
	request := &trade.AlipayTradePreCreateRequest{}
	// 设置参数
	request.BizContent.OutTradeNo = "L123456"
	// 请求响应
	var response trade.AlipayTradePreCreateResponse
	err := client.Execute(request, &response)
	if err != nil {
		// 错误处理
		fmt.Println(err)
	} else {
		if response.IsSuccess() {
			fmt.Println("调用成功")
		} else {
			fmt.Println("调用失败")
		}
	}
}